﻿@namespace BlazorTable
@typeparam TableItem

@foreach (var propertyInfo in (Type == null ? typeof(TableItem).GetProperties() : Type.GetProperties() ))
{
    if(propertyInfo.PropertyType.MemberType == System.Reflection.MemberTypes.NestedType)
    {
        <DynamicColumns TableItem="TableItem" Type="@propertyInfo.PropertyType" Sortable="Sortable" Filterable="Sortable" />
    } else {

        var member = GenerateMemberExpression<TableItem, object>(propertyInfo);
        
        <Column TableItem="TableItem" Title="@propertyInfo.Name" Type="Utilities.GetNonNullableType(propertyInfo.PropertyType)" Field="member" Sortable="Sortable" Filterable="Filterable" Class="Class">
            <Template>
                @RenderProperty(context, propertyInfo, member.Compile())
            </Template>
        </Column>
    }
}
